<?php
/**
 * > エラーコントローラ
 *
 * LICENSE: Miracle Maple by Mirage is licensed
 * under a Creative Commons 表示-非営利-継承 2.1 日本 License.
 *
 * @category   error
 * @package    maple-story.jp
 * @version    8.0.0
 * @link       http://maple-story.jp/
 * @since      File available since Release 8.0.0
 * @copyright  Copyright 2011 Miracle Maple
 * @license    http://creativecommons.org/licenses/by-nc-sa/2.1/jp/     Creative Commons BY-NC-SA
 */ 
class ErrorController extends Zend_Controller_Action
{
    /**
     * デフォルトエラーアクション
     */
    public function errorAction()
    {
        $errors = $this->_getParam('error_handler');
        $debug = Zend_Registry::get('DEBUG_MODE');

		$exception = $errors->exception;
		if (!$debug) {
			$logger = Zend_Registry::get('APPLICATION_LOG');
            $logger->err($exception->getMessage() . PHP_EOL
                         . $exception->getTraceAsString());

            $this->getResponse()->setRawHeader('HTTP/1.1 404 Not Found');
            return $this->_forward('notfound');
        }
		

        $this->view->headTitle(get_class($exception), 'PREPEND');
		$this->view->headMeta()->appendName('robot', 'noindex,follow');
		$this->view->topicPath = array(array('name' => get_class($exception)));
        $this->view->exception = $exception;
        $this->view->request = $this->getRequest();
    }

    /**
     * 404 エラーアクション
     */
    public function notfoundAction()
    {
        $this->view->headTitle('ページが見つかりません', 'PREPEND');
    }
        
}
